/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-01-12 09:35:49
 * @LastEditTime : 2023-06-27 13:52:29
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\Organization.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { DelDataButton, OpenThrTouter } from '../Common/options'
import { ProjectList, PersonType } from '../Common/Conversion'

export const SecurityActivityPerson = async ({ OptionsEvent, oneData, Permission, actionRef, ClientData }) => {
    const { hostname } = window.location
    const projectUuid = await ProjectList()
    let data = {
        pageSize: 10,
        hideInSearch: !hostname.includes('jszx'),
        params: { SecurityActivityUuid: oneData.uuid },
        get: API_LIST()['getSecurityActivityPerson'],
        options: [
            <OpenThrTouter
                key="add"
                title="新增人员"
                type="primary"
                icon="add"
                twoTitle="添加活动参与人员"
                modal="SelectModal"
                OptionsEvent={OptionsEvent}
                other={{
                    page: 'SecurityActivityPerson',
                    actionRef,
                    Permission,
                    twoData: oneData,
                }}
            />,
        ],
        columns: [
            commonTableList.uuid,
            {
                ...commonTableList.projectUuid,
                valueEnum: projectUuid,
                hideInAdded: true,
                hideInModify: true,
                hideInTable: true,
                hideInSearch: !hostname.includes('jszx'),
                order: 3,
            },
            {
                title: '组织机构',
                dataIndex: ['person', 'organization', 'tableName'],
            },
            {
                title: '姓名',
                dataIndex: ['person', 'tableName'],
            },
            {
                title: '人员类别',
                dataIndex: ['person', 'personTypeUuid'],
                valueType: 'select',
                valueEnum: await PersonType(),
            },
            {
                title: '人员性质',
                dataIndex: ['person', 'categoryUuid'],
                valueType: 'select',
                valueEnum: ClientData.dictionary['51297964-6295-475a-8219-d3f9a4568fe6'],
                hideInAdded: !hostname.includes('jtgj'),
                hideInModify: !hostname.includes('jtgj'),
                hideInTable: !hostname.includes('jtgj'),
                hideInSearch: !hostname.includes('jtgj'),
            },
            {
                title: '签到时间',
                dataIndex: 'signDate',
                valueType: 'input',
                render: (_, e) => <div>{e.signDate || '还未签到'}</div>,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url="SecurityActivityPerson"
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }
    return data
}
